function PunchDamage takes nothing returns nothing
	local unit target = GetEnumUnit()
	local location targetLocation = GetUnitLoc(target)
	local real angle = AngleBetweenPoints(udg_TempCasterLocation , targetLocation)
	//--
	if (IsUnitEnemy(target , udg_TempPlayer) and IsUnitInRangeLoc(target , udg_TempCasterLocation , udg_TempRadius) and not IsUnitType(target , UNIT_TYPE_STRUCTURE) and GetUnitState(target , UNIT_STATE_LIFE) > 0.0 and WithinAngle(angle , udg_TempCastAngle , udg_TempEffectiveAngle)) then
		call UnitDamageTarget(udg_TempCaster , target , udg_TempDamage , true , false , ATTACK_TYPE_NORMAL, DAMAGE_TYPE_COLD , WEAPON_TYPE_METAL_MEDIUM_BASH)
	endif
	//--
	set target = null
	call RemoveLocation(targetLocation)
	set targetLocation = null
endfunction

function Trig_Punch_Actions takes nothing returns nothing
	local unit punchingUnit = GetTriggerUnit()
	//--
	set udg_TempCaster = punchingUnit
	set udg_TempPlayer = GetOwningPlayer(punchingUnit)
	set udg_TempDamage = 15.0 + LoadReal(udg_UnitDataHashTable , GetHandleId(punchingUnit) , StringHash("PUNCH_MASTERY")) * 2.5
	set udg_TempRadius = 100.0
	set udg_TempEffectiveAngle = 100.0
	set udg_TempCasterLocation = GetUnitLoc(punchingUnit)
	set udg_TempSpellTargetLocation = GetSpellTargetLoc()
	set udg_TempCastAngle = AngleBetweenPoints(udg_TempCasterLocation , udg_TempSpellTargetLocation)
	call RemoveLocation(udg_TempSpellTargetLocation)
	set bj_wantDestroyGroup = true
	call ForGroupBJ(GetUnitsInRangeOfLocMatching(udg_TempRadius+70.0, udg_TempCasterLocation , null) , function PunchDamage)
	call RemoveLocation(udg_TempCasterLocation)
	call UnitPlayAnimation(punchingUnit , 43 , 3.0 , 0.4)
	call UnitUsedAbilityWithDelta(punchingUnit , 'A00A' , 1.0)
	//--
	set punchingUnit = null
endfunction

function Trig_Punch_Conditions takes nothing returns boolean
	return GetSpellAbilityId() == 'A00A'
endfunction

function InitTrig_Punch takes nothing returns nothing
	local hashtable masteryTable = InitHashtable()
	local integer abilityId = 'A00A'
	//--	
	//call SaveInteger(udg_AbilityDataHashTable , abilityId , StringHash("NEXT_ABILITY") , 'A01X')
	call SaveInteger(udg_AbilityDataHashTable , abilityId , StringHash("HOTKEY") , StringHash("E"))
	call SaveInteger(udg_AbilityDataHashTable , abilityId , StringHash("MASTERY_ID") , StringHash("PUNCH_MASTERY"))
	call SaveStr(udg_AbilityDataHashTable , abilityId , StringHash("NAME") , "直拳")
	call SaveInteger(udg_AbilityDataHashTable , abilityId , StringHash("MAX_LEVEL") , 1)
	call SaveHashtableHandle(udg_AbilityDataHashTable , abilityId , StringHash("LEVEL_MASTERY_TABLE") , masteryTable)
	//call SaveReal(masteryTable , 1 , 0 , 1.0) //30
	//call SaveReal(masteryTable , 2 , 0 , 2.0) //70
	//call SaveReal(masteryTable , 3 , 0 , 3.0) //120
	
	set gg_trg_Punch = CreateTrigger()
	call TriggerRegisterAnyUnitEventBJ(gg_trg_Punch , EVENT_PLAYER_UNIT_SPELL_EFFECT)
	call TriggerAddCondition(gg_trg_Punch , Condition(function Trig_Punch_Conditions))
	call TriggerAddAction(gg_trg_Punch , function Trig_Punch_Actions)
endfunction

